# #!/usr/bin/python3.9
# # -*- coding: utf-8 -*-
# # @Time    : 2022/7/15 10:30 上午
# # @Author  : super_gou
# # @File    : second.py
#
# #列表
# # name_list = ['Tom', 'Lily', 'Rose']
# # print(name_list[0])
# # print(name_list[1])
# # print(name_list[2])
#
# #index()：返回指定数据所在位置的下标 语法：列表序列.index(数据, 开始位置下标, 结束位置下标)
# # name_list = ['Tom', 'Lily', 'Rose']
# # print(name_list.index('Lily', 0, 2))
# # print(name_list.index('lyly', 0, 2))
#
# #len()：访问列表⻓度，即列表中数据的个数
# # name_list = ['Tom', 'Lily', 'Rose']
# # print(len(name_list))
#
# #count()：统计指定数据在当前列表中出现的次数
# # name_list = ['Tom', 'Lily', 'Rose']
# # print(name_list.count('Lily'))
# # name_list1 = ['Tom', 'Lily', 'Rose','Lily']
# # list11 =[]
# # for i in range(len(name_list1)):
# #     list11.append(name_list1[i].lower())
# # print(list11.count('lily'))
#
# #判断指定数据在某个列表序列，如果在返回True，否则返回False
# # name_list = ['Tom', 'Lily', 'Rose']
# # print('Lily' in name_list)
# # print('Lily' not in name_list)
# # print('Lilys' in name_list)
# # print('Lilys' not in name_list)
#
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # name = input('请输⼊您要搜索的名字：')
# # name1 = name.title() 首字母转换成大写
# # print(name1)
# # if name1 in name_list:
# #     print(f'您输⼊的名字是{name}, 名字已经存在')
# # else:
# #     print(f'您输⼊的名字是{name}, 名字不存在')
#
# #列表 append，extend，insert，del，pop，remove，clear，reverse
# # name_list = ['Tom', 'Lily', 'Rose']
# # name_list.append('xiaoming')
# # print(name_list)
# # name_list.append(['xiaoming', 'xiaohong'])
# # print(name_list)
# # name_list.extend('xiaoming')
# # print(name_list)
# # name_list.extend(['xiaoming', 'xiaohong'])
# # print(name_list)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # name_list.insert(1, 'xiaoming')
# # print(name_list)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # del name_list
# # print(name_list)
# # del name_list[0]
# # print(name_list)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # del_name = name_list.pop(1)
# # print(del_name)
# # print(name_list)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # name_list.remove('Rose')
# # print(name_list)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # name_list.clear()
# # print(name_list)
#
# # num_list = [1, 5, 2, 3, 6, 8]
# # name_list = ['Tom', 'Lily', 'Rose','Tom']
# # name_list.reverse()
# # num_list.reverse()
# # print(num_list)
# # print(name_list)
# # print(name_list.count('Tom'))
# # name_list.sort()
# # print(name_list)
# # name_list.sort(key=str.lower)
# # print(name_list)
# # num_list.sort(reverse=True)
# # print(num_list)
# # num_list.sort()
# # print(num_list)
#
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # name_li2 = name_list.copy()
# # print(name_li2)
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # i = 0
# # while i < len(name_list):
# #     print(name_list[i])
# #     i += 1
#
# # name_list = ['Tom', 'Lily', 'Rose']
# # for i in name_list:
# #     print(i)
#
# # name_list = [['⼩明', '⼩红', '⼩绿'], ['Tom', 'Lily', 'Rose'], ['张三', '李四','王五']]
# # print(name_list[2])
# # print(name_list[2][1])
#
# #有三个办公室，8位⽼师，8位⽼师随机分配到3个办公室
# import random
# # teachers = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff', 'gg', 'hh']
# # offices = [[], [], []]
# # for name in teachers:
# #     num = random.randint(0, 2)
# #     offices[num].append(name)
# # i = 1
# # for office in offices:
# #     print(f'办公室{i}的人数是{len(office)}.老师分别是：', end='')
# #     i += 1
# #     for name in office:
# #         print(name, end='...')
# #     print('')
#
#
# #元组
# # t2 = (10,)
# # print(type(t2))
# # t3 = (20)
# # print(type(t3))
# # t4 = ('hello')
# # print(type(t4))
#
# # tuple1 = ('aa', 'bb', 'cc', 'bb')
# # print(tuple1[0])
#
# # tuple1 = ('aa', 'bb', 'cc', 'bb')
# # print(tuple1.index('aa'))
# #
# # tuple1 = ('aa', 'bb', 'cc', 'bb')
# # print(tuple1.count('bb'))
# #
# # tuple1 = ('aa', 'bb', 'cc', 'bb')
# # print(len(tuple1))
#
# # tuple1 = ('aa', 'bb', 'cc', 'bb')
# # tuple1[0] = 'aaa'
#
# # tuple2 = (10, 20, ['aa', 'bb', 'cc'], 50, 30)
# # print(tuple2[2])
# # tuple2[2][0] = 'aaaaa'
# # print(tuple2)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # dict1['name'] = 'Rose'
# # print(dict1)
# # dict1['id'] = 110
# # print(dict1)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # del dict1['gender']
# # print(dict1)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # dict1.clear()
# # print(dict1)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # print(dict1.get('name'))
# # print(dict1.get('id', 110))
# # print(dict1.get('id'))
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # print(dict1.keys())
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # print(dict1.values())
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # print(dict1.items())
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # for key in dict1.keys():
# #     print(key)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # for key in dict1.values():
# #     print(key)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # for key in dict1.items():
# #     print(key)
#
# # dict1 = {'name': 'Tom', 'age': 20, 'gender': '男'}
# # for key, value in dict1.items():
# #     print(f'{key} : {value}')
#
# #集合
# # s1 = {10, 20, 30, 40, 50}
# # print(s1)
# # s2 = {10, 30, 20, 10, 30, 40, 30, 50}
# # print(s2)
# # s3 = set('abcdefg')
# # print(s3)
# # s4 = set()
# # print(type(s4))
# # s5 = {}
# # print(type(s5))
#
# # s1 = {10, 20}
# # s1.add(100)
# # s1.add(10)
# # print(s1)
#
# # s1 = {10, 20}
# # s1.update(100) # 报错
# # s1.update([100, 200])
# # s1.update('abc')
# # print(s1)
#
# # s1 = {10, 20}
# # s1.remove(10)
# # print(s1)
# # s1.remove(10) # 报错
# # print(s1)
#
# # s1 = {10, 20}
# # s1.discard(10)
# # print(s1)
# # s1.discard(10)
# # print(s1)
#
# # s1 = {10, 20, 30, 40, 50}
# # del_num = s1.pop()
# # print(del_num)
# # print(s1)
#
# # s1 = {10, 20, 30, 40, 50}
# # print(10 in s1)
# # print(10 not in s1)
#
# # 1. 字符串
# # str1 = 'aa'
# # str2 = 'bb'
# # str3 = str1 + str2
# # print(str3)
# # 2. 列表
# # list1 = [1, 2]
# # list2 = [10, 20]
# # list3 = list1 + list2
# # print(list3)
# # 3. 元组
# # t1 = (1, 2)
# # t2 = (10, 20)
# # t3 = t1 + t2
# # print(t3)
#
# # 1. 字符串
# # print('-' * 10)
# # 2. 列表
# # list1 = ['hello']
# # print(list1 * 4)
# # 3. 元组
# # t1 = ('world',)
# # print(t1 * 4)
#
# # 1. 字符串
# # print('a' in 'abcd')
# # print('a' not in 'abcd')
# # # 2. 列表
# # list1 = ['a', 'b', 'c', 'd']
# # print('a' in list1)
# # print('a' not in list1)
# # # 3. 元组
# # t1 = ('a', 'b', 'c', 'd')
# # print('aa' in t1)
# # print('aa' not in t1)
#
# # list1 = ['a', 'b', 'c', 'd', 'e']
# # for i in enumerate(list1):
# #     print(i)
# # for index, char in enumerate(list1, start=1):
# #     print(f'下标是{index}, 对应的字符是{char}')
#
# # list1 = [10, 20, 30, 40, 50, 20]
# # s1 = {100, 200, 300, 400, 500}
# # print(tuple(list1))
# # print(tuple(s1))
#
# # t1 = ('a', 'b', 'c', 'd', 'e')
# # s1 = {100, 200, 300, 400, 500}
# # print(list(t1))
# # print(list(s1))
#
# # list1 = [10, 20, 30, 40, 50, 20]
# # t1 = ('a', 'b', 'c', 'd', 'e')
# # print(set(list1))
# # print(set(t1))
#
# # list1 = [i for i in range(10)]
# # print(list1)
#
# # list1 = [i for i in range(0, 10, 2)]
# # print(list1)
#
# # list1 = [i for i in range(10) if i % 2 == 0]
# # print(list1)
#
# # list1 = [(i, j) for i in range(1, 3) for j in range(3)]
# # print(list1)
#
# # dict1 = {i: i**2 for i in range(1, 5)}
# # print(dict1)
#
# # list1 = ['name', 'age', 'gender']
# # list2 = ['Tom', 20, 'man']
# # dict1 = {list1[i]: list2[i] for i in range(len(list1))}
# # print(dict1)
#
# # counts = {'MBP': 268, 'HP': 125, 'DELL': 201, 'Lenovo': 199, 'acer': 99}
# # # 需求：提取上述电脑数量⼤于等于200的字典数据
# # count1 = {key: value for key, value in counts.items() if value >= 200}
# # print(count1)
#
# #求100以内能被3整除的数，并将作为列表输出
# # list1 = []
# # for i in range(100):
# #     if i % 3 ==0:
# #         list1.append(i)
# # print(list1)
#
# # list2 = [i for i in range(1,100) if i % 3 == 0]
# # print(list2)
# #列表[1,2,3,4,3,4,2,5,5,8,9,7],将此列表去重，得到一个唯一元素的列表  #不允许用强制类型转化
# # list11 =[1,2,3,4,3,4,2,5,5,8,9,7]
# # list22 = []
# # for i in list11:
# #     if i not in list22:
# #         list22.append(i)
# # print(list22)
#
# # 求斐波那契数列 1 1 2 3 5 8 13 ……
# a,b =1,1
# list1 =[]
# list1.append(a)
# for i in range(10):
#     a,b = b,a+b
#     list1.append(a)
# print(list1)
# 5、求100以内的质数（只能被1和它本身整除）
# for i in range(1,100):
#     for j in range(2,i):
#         if i%j ==0:
#             break
#     else:
#         print(i, end=' ')

# 6、有一堆字符串“aabbbcddef”打印出不重复的字符串结果：cef
# str1 = 'aabbbcddef'
# str2 = ''
# for i in str1:
#     if str1.count(i) == 1:
#         str2 = str2 + i
# print(str2)
# 7、有一堆字符串，“welocme to super&Test”，打印出superTest，不能查字符的索引
# str1 = 'welocme to super&Test'
# list1 = str1.split(' ')
# print(list1)
# for i in list1:
#     list2 = i.split("&")
#     print(list2)
#     if len(list2)>1:
#         print(''.join(list2))
# 8、有一堆字符串，“welocme to super&Test”，打印出tseT&repus ot ……全部单词原位置反转  #不允许用reverse
# str1 = 'welocme to super&Test'
# str2 = str1[::-1]
# print(str2)

# str1 = 'welocme to super&Test'
# list1 = list(str1)
# print(list1)
# str2 = ''
# for i in range(len(list1)):
#     str2 = str2+list1.pop()
# print(str2)
# 9、有一堆字符串，“abcdef”，将收尾反转，结果：fedcba，不能使用现有的函数或方法，自己写算法实现
# 10、有一堆字符串，“aabbbcddef”，输出abcdef # 不允许用set
# str1 = 'aabbbcddef'
# str2 = ''
# for i in str1:
#     if i not in str2:
#         str2 = str2+i
# print(str2)


